-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Hierarchies #1432
base: dev
Are you sure you want to change the base?
Custom Hierarchies #1432
Conversation
|
||
private: | ||
template <typename... Arg> | ||
iterator makeIterator(Arg &&...arg) |
Check notice
Code scanning / CodeQL
Unused local variable Note
return iterator{this, std::forward<Arg>(arg)...}; | ||
} | ||
template <typename... Arg> | ||
const_iterator makeIterator(Arg &&...arg) const |
Check notice
Code scanning / CodeQL
Unused local variable Note
test/CoreTest.cpp
Outdated
REQUIRE(r["x"].resetDataset(dset).numAttributes() == 0); /* unitSI */ | ||
// REQUIRE(r["y"].unitSI() == 1); | ||
REQUIRE(r["y"].resetDataset(dset).numAttributes() == 0); /* unitSI */ | ||
// REQUIRE(r["z"].unitSI() == 1); |
Check notice
Code scanning / CodeQL
Commented-out code Note test
test/CoreTest.cpp
Outdated
// unitSI is set upon flushing | ||
// REQUIRE(r["x"].unitSI() == 1); | ||
REQUIRE(r["x"].resetDataset(dset).numAttributes() == 0); /* unitSI */ | ||
// REQUIRE(r["y"].unitSI() == 1); |
Check notice
Code scanning / CodeQL
Commented-out code Note test
test/CoreTest.cpp
Outdated
@@ -966,6 +968,27 @@ | |||
#endif | |||
} | |||
|
|||
TEST_CASE("baserecord_test", "[core]") |
Check notice
Code scanning / CodeQL
Unused static function Note test
autoRegistrar37
// for (auto it = this->container().begin(); it != end; ++it) | ||
// { | ||
// if (it->first == RecordComponent::SCALAR) | ||
// { | ||
// this->container().erase(it); | ||
// throw error::WrongAPIUsage(detail::NO_SCALAR_INSERT); | ||
// } | ||
// } |
Check notice
Code scanning / CodeQL
Commented-out code Note
// for (auto it = this->container().begin(); it != end; ++it) | ||
// { | ||
// if (it->first == RecordComponent::SCALAR) | ||
// { | ||
// this->container().erase(it); | ||
// throw error::WrongAPIUsage(detail::NO_SCALAR_INSERT); | ||
// } | ||
// } |
Check notice
Code scanning / CodeQL
Commented-out code Note
test/CoreTest.cpp
Outdated
@@ -1353,3 +1378,44 @@ | |||
UniquePtrWithLambda<int[]> arrptrFilledCustom{ | |||
new int[5]{}, [](int const *p) { delete[] p; }}; | |||
} | |||
|
|||
TEST_CASE("scalar_and_vector", "[core]") |
Check notice
Code scanning / CodeQL
Unused static function Note test
autoRegistrar61
6c7f23a
to
c692dc7
Compare
c8a68a5
to
6c87958
Compare
86d8a73
to
399e6cd
Compare
comment removed, updated version in comments below |
8c28fab
to
605bd55
Compare
bef9c6b
to
b4779a3
Compare
For the meshesPath (equivalently for particlesPath), I have now implemented a prototype that does the following: A path
The underlying rule: Full paths are denoted by a leading slash and are based on the data path ( Remark: The shorthand notation achieves backwards compatibility with old openPMD files |
One nontrivial design question is how to deal with the traditional openPMD hierarchy, especially with the paths This suggests to me that in the extended openPMD standard with custom hierarchies these paths should be treated as "nothing special". Rather, they become the canonical, but not mandatory layout/organization of a simple openPMD dataset. Two somewhat tricky consequences from this point of view: 1. There might be more than 1 meshes paths in the same group Imo, the best solution is to consider
(Note: Since
|
b0d370e
to
4873e21
Compare
53f968c
to
ba10099
Compare
ba10099
to
d86fa69
Compare
31c7a25
to
1d47d17
Compare
What's the status/schedule here?
I assume that this is because the attributes in "groups" are not parsed by default.
and here's what's in the file
Any short/long term recommendations? |
Introduction of iteration["meshes"].asContainerOf<Mesh>() as a more explicit variant for iteration.meshes.
Overload resolution
TODO: Since meshes/particles can no longer be directly addressed with this, maybe adapt the class hierarchy to disallow mixed groups that contain meshes, particles, groups and datasets at the same time. Only maybe though..
The have their own meaning now and are no longer just carefully maintained for backwards compatibility. Instead, they are supposed to serve as a shortcut to all openPMD data found further down the hierarchy.
for more information, see https://pre-commit.ci
ffb510c
to
20f2cd5
Compare
The openPMD standard works by defining "what must be there", but does not impose restrictions as to "what must not be there". By this principle, openPMD is an extensible standard.
So far, standard extensions relied mostly on defining additional metadata in terms of attributes, e.g. for storing the name of the employed field solver for the ED-PIC extension. Custom hierarchies and custom n-dimensional datasets ("heavy" data in comparison to lightweight metadata) have not been employed so far despite the theoretical possibility to do so, granted by the openPMD standard. The major hindrance to such data organization has been the lacking support at the level of the openPMD-api, i.e. the implementation of the standard.
As the first part of this PR, the openPMD-api now supports writing custom-defined hierarchies and datasets within the basepath, i.e. within Iterations. This change is entirely independent from the standard as it makes use of the already existing liberty within the standard's conception as explained in the introduction.
This alone finds useful applications already:
Building on top of this, the other logical component of this PR consists in the support of this standard extension. While the PR as described so far brings custom hierarchies and datasets to the openPMD-api in a way that is transparent to the standard itself, the purpose of this next standard extension is to now make the standard aware of these hierarchies by embedding openPMD markup within them.
The schematic idea behind this is pictured below:
With this, the data organization can step back into openPMD markup from anywhere within a custom-defined hierarchy. This further extends the use of this PR to:
TODO
SharedAttributableData
pattern to better implement variable-based encoding (whereseries.iterations
andseries.iterations[0]
are the same backend objects)Iteration::meshes
withIteration::mesh("subdir/E")
andIteration::allMeshes() -> std::map<std::string, Mesh>
, similarIteration::species("subdir/e")
andIteration::allSpecies() -> std::map<std::string, ParticleSpecies>
. But should it bespecies("subdir/particles/e")
orspecies("subdir/e")
?Attributable::openAsCustomHierarchy()
?Diff: https://github.com/franzpoeschel/openPMD-api/compare/topic-remove-scalar-component..topic-custom-hierarchies